import 'package:boss/models/takeout_order_list_data.dart';
import 'package:boss/provider/takeout_process_provider.dart';
import 'package:boss/ui/widget/button/outline_radius_button.dart';
import 'package:boss/ui/widget/button/radius_button.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class NewOrderButtonGroup extends StatelessWidget {
  final TakeoutOrderItem data;

  const NewOrderButtonGroup({Key key, this.data}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      children: <Widget>[
        Expanded(
          child: RadiusButton(
            title: '接单',
            onTap: () async {
              var provider = Provider.of<TakeoutProcessProvider>(context, listen: false,);
              provider.getOrder(
                data.takeOutId,
                data.systemOrderStatus,
              );
            },
          ),
          flex: 2,
        ),
        SizedBox(
          width: 30.w,
        ),
        Expanded(
          child: OutlineRadiusButton(
            title: '拒单',
            onTap: () async {
              var provider = Provider.of<TakeoutProcessProvider>(context, listen: false,);
              provider.rejectOrder(data.takeOutId);
            },
          ),
          flex: 1,
        ),
      ],
    );
  }
}
